package com.laicunba.ext.web.controller.h5.template;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.laicunba.ext.web.controller.SuiCunBaoBaseController;
import com.laicunba.pojo.UserDO;
import com.laicunba.service.UserService;
import com.laicunba.util.DateUtil;

/**
 * velocity模板引擎测试
 * 
 * @author lws
 *
 */
@Controller
@RequestMapping(value="/h5/ext/template")
public class TemplateTestController extends SuiCunBaoBaseController {
	@Autowired
	private UserService userService;
	
	/**
	 * 测试
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/template_test.htm")
	public ModelAndView depositoryNews(HttpServletRequest request) {
		ModelAndView view = new ModelAndView("test.vm");
		
		List<UserDO> list = userService.findByBirthday("0215", 10);
		view.addObject("users", list);
		view.addObject("title", "test20170818");
		view.addObject("now", new Date());
		view.addObject("dateFormat", new DateUtil());
		return view;
	}
	
}
